﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using ERP_RORZE_DLL.Product.database;
using ERP_RORZE_DLL.Product.DAO;

namespace ERP_RORZE.Product.PartHandling
{
    public partial class frm_BusInspInput : DevExpress.XtraEditors.XtraForm
    {
        public event EventHandler Reload;
        ClsDBusInspTable clsObj = new ClsDBusInspTable();
        ClsPartHandlingDAO clsDAO = new ClsPartHandlingDAO();
        DataTable dt;
        public frm_BusInspInput()
        {
            InitializeComponent();
        }

        private void btnExit_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnAdd_Click(object sender, EventArgs e)
        {
            clsObj.Date = dateDate.Value;
            clsObj.BusQty = int.Parse(txtBusQty.Text);
            clsObj.Finished = checkFinished.Checked;
            clsObj.MONo = cbMONo.Text;
            clsObj.Note = txtNote.Text;
            clsObj.StaffID = cbStaffID.Text;
            MessageBox.Show("" + clsObj.Date + clsObj.Finished + clsObj.BusQty);
            clsDAO.InsertBusInspDetail(clsObj);
            Reload(sender,e);
        }

        private void frm_BusInspInput_Load(object sender, EventArgs e)
        {
            //lấy danh sách MONo cho vào combo
            dt = clsDAO.GetlAllMONo();
            cbMONo.DataSource = dt;
            cbMONo.DisplayMember = "MONo";
            cbMONo.ValueMember = "MONo";

            //lấy danh sách StaffID cho vào combo
            dt = clsDAO.GetlAllStaffID();
            cbStaffID.DataSource = dt;
            cbStaffID.DisplayMember = "StaffID";
            cbStaffID.ValueMember = "StaffID";
        }
    }
}